package oo_day02;
/** 学生:  派生类/子类   */
public class Student extends Person {
    String className;
    String stuId;   //this指Student对象   super指 Person对象

    Student(String name,int age, String address,String className,String stuId){

        super(name,age,address);//给name,age,address赋值
        /*
        //成员变量name若没有同名现象:写this.name和super.name都一样
        //成员变量name若有同名现象:
        //1)super.name指的是超类的name  this.name指的是当前类的name
        super.name = name;          //super给超类赋值
        super.age = age;
        super.address = address;
         */
        this.className = className; //给子类赋值
        this.stuId = stuId;
    }

    void study(){
        System.out.println(name+"正在学习...");
    }
    void sayHi(){   //方法的重写
        System.out.println("大家好,我叫"+name+",今年"+age+"岁了"+",家住"+address+",学号是:"+stuId);
    }
}
